package com.kingyun.gpsinspection.purificationservice.services.iam.taskjobservice;

import com.kingyun.gpsinspection.purificationservice.facade.service.iam.up.LoginLogService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by ${yangsy} on 2017/4/24.
 */
public class DoLogJobService implements Job {
    public org.slf4j.Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private LoginLogService loginLogService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            //  登录日志每个月清空一次
            int delCount = loginLogService.deleteAll();
            logger.info("定时任务清空操作日志共计：" + delCount + "条");
        }catch (Exception e){
            logger.error("定时任务清空操作日志异常:"+e.getMessage());
        }
    }
}
